//
//  ShareEditView.m
//  Pictorial
//
//  Created by SKY on 15/12/30.
//  Copyright © 2015年 sky. All rights reserved.
//

#import "ShareEditView.h"
#import <UIImageView+WebCache.h>
@interface ShareEditView ()

@property (weak, nonatomic) IBOutlet UIView *shareView;
@property (weak, nonatomic) IBOutlet UIImageView *pictureView;
@property (weak, nonatomic) IBOutlet UITextView *contentView;
@property (weak, nonatomic) IBOutlet UILabel *shareTitle;

@end

@implementation ShareEditView
-(void)willMoveToSuperview:(UIView *)newSuperview{
    self.frame = newSuperview.bounds;
    self.shareView.layer.cornerRadius = 10;
    self.shareView.clipsToBounds = YES;
}
-(void)setType:(NSInteger)type{
    _type = type;
    NSArray *array = @[@"新浪分享",@"QQ分享",@"QQ空间分享",@"微信分享",@"微信朋友圈",@"微信收藏"];
    self.shareTitle.text = array[type];
}
-(void)setPicture:(NSString *)picture{
    _picture = picture;
    [self.pictureView sd_setImageWithURL:[NSURL URLWithString:picture]];
}
-(void)setContent:(NSString *)content{
    _content = content;
    self.contentView.text = content;
}
- (IBAction)close:(id)sender {
    [self removeFromSuperview];
}
- (IBAction)commit:(id)sender {
    [_delegate shareOnPlatform:self.type content:self.contentView.text];
    [self removeFromSuperview];
}

@end
